package com.dsteiner.gwt.cafeteriasophia.client;

import com.dsteiner.gwt.cafeteriasophia.client.model.HistoryModel;
import com.dsteiner.gwt.cafeteriasophia.client.model.NavModel;
import com.dsteiner.gwt.cafeteriasophia.client.model.ShiftChangeModel;
import com.dsteiner.gwt.cafeteriasophia.client.model.StatisticModel;
import com.dsteiner.gwt.cafeteriasophia.client.resources.CafeteriasophiaResources;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.StyleInjector;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Cafeteriasophia implements EntryPoint {

	private ShiftChangeModel shiftChangeModel = new ShiftChangeModel();;
	private NavModel navModel = new NavModel();
	
	public void onModuleLoad() {
		System.out.println("Cafeteriasophia.onModuleLoad()");
		StyleInjector.injectStylesheet(CafeteriasophiaResources.INSTANCE.css().getText());
		ShiftChangeWidget shiftChangeWidget = new ShiftChangeWidget(shiftChangeModel);
		HistoryModel historyModel = new HistoryModel();
		HistoryWidget historyWidget = new HistoryWidget(historyModel);
		StatisticModel statisticModel = new StatisticModel();
		StatisticWidget statisticWidget = new StatisticWidget(statisticModel);
		NavWidget navWidget = new NavWidget(navModel);
		
		navModel.addPage(NavModel.PAGE_ID_NAV, navWidget);
		navModel.addPage(NavModel.PAGE_ID_SHIFT_CHANGE, shiftChangeWidget);
		navModel.addPage(NavModel.PAGE_ID_HISTORY, historyWidget);
		navModel.addPage(NavModel.PAGE_ID_STATISTIC, statisticWidget);
		
		RootPanel.get().add(navWidget);
		RootPanel.get().add(shiftChangeWidget);
		RootPanel.get().add(historyWidget);
		RootPanel.get().add(statisticWidget);
	}
}
